package com.hw.one.collect.spadata.job;

import com.hw.one.collect.spadata.po.MissData;
import com.hw.one.collect.spadata.po.SpaPo;
import com.hw.one.collect.util.SerializeUtil;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/8/22.
 */
@Component
public class SpaRealTimeDataTest extends SpaDataJob {

    private static Logger log = Logger.getLogger(SpaRealTimeDataTest.class);


    public void start() {

        try {

            // 确定一个时间
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
            String searchTime = sdf.format(new Date());
            Map<String, String> paramMap = new HashMap<>();
            paramMap.put("beginTime", "2017-08-26 12:00:00");
            paramMap.put("endTime", "2017-09-11 13:00:00");
            log.debug("-----------开始拉取SPA数据【"+searchTime+"】------------------");
            // 执行请求
            List<SpaPo> spaPoList = execute(paramMap);
            for (SpaPo spaPo : spaPoList) {
                saveSpaData(spaPo);
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }


}
